package com.zb.spring5.annotation;

import com.zb.spring5.inteface.MessagePrivider;
import com.zb.spring5.inteface.MessagePrividerImpl;
import com.zb.spring5.inteface.MessageRender;
import com.zb.spring5.inteface.StandarOutMessagerRender;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TestConfiguration {
    /**
     * 这相当于<bean id="privider" class="..."/>
     * 一样的是注入容器
     */
    @Bean
    public MessagePrivider privider() {
        return new MessagePrividerImpl();
    }
    @Bean
    public MessageRender render() {
        StandarOutMessagerRender render = new StandarOutMessagerRender();
        render.setMessagePrivider(privider());
        return render;
    }

}
